package com.homework;

public class Homework04 {
    public static void main(String[] args) {

        new Cellphone().testWork(new Calculator() {
            @Override
            public double work(double n1, double n2) {
                return n1 + n2;
            }
        }, 10, 8);
    }


}

interface Calculator {
    double work(double n1, double n2);
}

class Cellphone {

    public void testWork(Calculator cal, double n1, double n2) {
        double result = cal.work(n1, n2);
        System.out.println("计算结果=" + result);
    }
}